{extend name="panel/layout" /}
{block name="main"}
<div class="row">
    {if condition="config('zz_gg_shequ')"}
    <div class="col-md-12 col-sm-6">
        <div class="panel">
            <div class="panel-body">
                {:getHtmlCode(config('zz_gg_shequ'))}
            </div>
        </div>
    </div>
    {/if}
    <div class="col-md-6">
        <div class="panel">
            <div class="panel-heading">代刷下单<span class="pull-right">
                    <label class="label label-success pull-right">
                        剩余金币：{$userInfo.point}
                    </label>
                </span></div>
            <div class="panel-body">
                <form method="post" class="form-horizontal">
                    <input type="hidden" name="mod" value="coin">
                    <div class="form-group">
                        <label class="control-label col-sm-2">选择下单QQ:</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="qid">
                                {volist name="qqList" id="qq"}
                                <option value="{$qq.qid}" {if condition="$qq.qid eq $aqid" }selected{
                                /if}>{$qq.uin}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">代刷项目:</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="sqid" id="shequ" onchange="getPoint();">
                                {volist name="sqList" id="sq"}
                                <option value="{$sq.sqid}" price="{$sq.p}">{$sq.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">份数:</label>
                        <div class="col-sm-10">
                            <input type="number" name="num" value="1" placeholder="输入下单份数" class="form-control"
                                   onchange="getPoint();">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">消耗金币:</label>
                        <div class="col-sm-10">
                            <div class="input-group">
                                <input type="text" value="{if condition=" isset($sqList[0])"}{$sqList[0]['p']}{else/}0{/if}"
                                class="form-control" id="need"
                                disabled>
                                <div class="input-group-addon">个</div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-sm-2"></label>
                        <div class="col-sm-10">
                            <button class="btn btn-success" type="submit">&lt;&lt;&lt;下单&gt;&gt;&gt;</button>
                            <a class="btn btn-success" type="submit" id="search">查询订单</a>
                        </div>
                    </div>
                </form>
            </div><!-- .widget-body -->
        </div><!-- .widget -->
    </div>

    <div class="col-md-6">
        <div class="panel">
            <div class="panel-heading">代刷订单列表</div>
            <div class="panel-body table-responsive">
                <table class="table table-hover table-striped">
                    <thead>
                    <tr>
                        <th>#ID</th>
                        <th class="text-center">代刷项目</th>
                        <th class="text-center">Q Q</th>
                        <th class="text-center">份数</th>
                        <th class="text-center">下单时间</th>
                        <th class="text-center">状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="orderList" id="order" }
                    <tr>
                        <td>#{$order.id}</td>
                        <td class="text-center">{$order.name}</td>
                        <td class="text-center">{$order.uin}</td>
                        <td class="text-center">{$order.num}</td>
                        <td class="text-center">{$order.addtime}</td>
                        <td class="text-center">
                            {if condition="$order.status eq 0"}
                            等待中
                            {elseif condition="$order.status eq 1"}
                            进行中
                            {elseif condition="$order.status eq 2"}
                            已完成
                            {elseif condition="$order.status eq 3"}
                            异常
                            {/if}
                        </td>
                    </tr>
                    {/volist}
                    </tr>
                    </tbody>
                </table>
                <div class="text-center">{$pageList->showPage()}</div>
            </div><!-- .widget-body -->
        </div><!-- .widget -->
    </div>

    <div class="col-md-12" id="orderSearch" style="display: none;">
        <div class="panel">
            <div class="panel-heading">查询订单</div>
            <div class="panel-body">
                <Iframe id="iframe" width="100%" scrolling="no" frameborder="0" name="orderIframe"></iframe>
            </div>
        </div>
    </div>


</div>
{/block}
{block name="footJs"}
<script type="text/javascript">
    function getPoint() {
        var num = $("input[name='num']").val();
        var price = $('#shequ option:selected').attr("price");

        $('#need').val((price * num).toFixed(2));
    }
    $("#search").click(function () {
        $("#orderSearch").show();
        $("#iframe").attr("src", "http://kp.qqbug.net/s/s_zan.aspx");
        var iframe = document.getElementById("iframepage");
        try {
            iframe.height = iframe.contentWindow.document.documentElement.scrollHeight;
        } catch (ex) {
        }
    });
</script>
{/block}
